package com.example.controller;

import com.example.tools.HttpClientHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.HashMap;

/**
 * datetime : 2020/10/7 8:12
 * author : shenxiang
 */
@Controller
@RequestMapping("/job")
public class IndexController {

    @Autowired
    private HttpClientHelper httpClientHelper;

    @RequestMapping("/list")
    public ModelAndView index(ModelAndView model){
        model.setViewName("index");
        return model;
    }

    @RequestMapping("/proxy")
    @ResponseBody
    public String proxy(String msg){
        System.out.println("================================");
        System.out.println(msg);
        System.out.println("###########################################");
        HashMap<String,Object> param = new HashMap<>();
        param.put("body",msg);
        httpClientHelper.post("http://linux78/kafka_collect_log/lagou",param,null);
        return "ok";
    }
}
